<?php
namespace Home\Controller;

class IndexController extends CommonController{

	public function index(){
		
		$where = array();
		$where['delete_status'] = '1';
		$where['status'] = '1';
		//整车
		$where['type'] = '1';
		$bike_list = D('Goods')->where($where)->order('create_time desc')->page($page,16)->select();
		//零件
		$where['type'] = '2';
		$part_list = D('Goods')->where($where)->order('create_time desc')->page($page,16)->select();
		
		$this->assign('bike_list',$bike_list);
		$this->assign('part_list',$part_list);
		$this->display();
	}

	public function search(){
		I('keyword') || exit($this->display());
		$where = array();
		$where['delete_status'] = '1';
		$where['status'] = '1';
		$where['goods_name|profile'] = array('like','%'.I('keyword').'%');
		$page = I('page') ? (int)I('page') : 1;
		$this->assign('list',D('Goods')->where($where)->page($page,5)->select());
		if(IS_POST){
			$this->list || $this->error('');
			$this->display('search_list');
		}else{
			$this->display();
		}
	}

}